/*
 * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
 * Copyright (c) 1995 Martin Husemann
 * Some structure declaration borrowed from Paul Popelka
 * (paulp@uts.amdahl.com), see /sys/msdosfs/ for reference.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    This product includes software developed by Martin Husemann
 *    and Wolfgang Solfrank.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * $NetBSD: dosfs.h,v 1.4 1997/01/03 14:32:48 ws Exp $
 * $FreeBSD: src/sbin/fsck_msdosfs/dosfs.h,v 1.3 2003/12/26 17:24:37 trhodes Exp $
 */

#ifndef __FSCK_DIR_H__
#define __FSCK_DIR_H__

#include "hi_fstool.h"

#define FSCK_DIR_LN_LEN_MAX        (256)    /* long name maximal length */
#define FSCK_DIR_LNR_1ST_MARK      (0x40)   /* first long name record */
#define FSCK_DIR_LNR_SEQ_NUM_MASK  (0x1f)   /* mask to extract long record sequence number */
#define FSCK_DIR_NAME_LEN_MAX      (13)     /**8+1+3+1*/


/******FAT Dir entry  struct ****/
typedef struct FSCK_DIR_ENTRY_S
{
    struct FSCK_DIR_ENTRY_S
    *parent,                    /* previous tree  */
    *next,                      /* next brother */
    *child;                     /* directory have this*/
    char name[FSCK_DIR_NAME_LEN_MAX];    /* alias name first part */
    char lname[FSCK_DIR_LN_LEN_MAX];     /* real name */
    u_int flags;                /* attributes */
    u_int state;                /* dir entry state*/
    cl_t head;                      /* cluster num */
    u_int size;                 /* the filesize in bytes */
}FSCK_DIR_ENTRY_S;

typedef struct FSCK_DIR_BAK_NODE_S
{
    FSCK_DIR_ENTRY_S *dir;
    struct FSCK_DIR_BAK_NODE_S *next;
}FSCK_DIR_BAK_NODE_S;

/**********************functions ********************/
u_int FSCK_DIR_Reset(FSCK_BOOT_SECTOR_S *pstBoot);//api--->dir

void FSCK_DIR_Free(void);//api--->dir

u_int FSCK_DIR_HandleTree(int fs, FSCK_BOOT_SECTOR_S* pstBoot, HI_FSTOOL_CHECK_MODE_E enMode);//api--->dir

#endif
